package net.pimpas.logging.log4j.serviceprovider;

import net.pimpas.core.configuration.exception.ConfigurationException;
import net.pimpas.core.serviceprovider.ServiceProviderAnnotation;
import net.pimpas.core.serviceprovider.instancetype.ServiceProviderInstanceType;
import net.pimpas.logging.serviceprovider.LoggingServiceProvider;

import org.apache.log4j.Logger;

@ServiceProviderAnnotation(
		instanceType=ServiceProviderInstanceType.NORMAL,
		serviceProviderType=LoggingServiceProvider.class
	)
public class Log4jServiceProviderImpl implements Log4jServiceProvider {
	private Logger logger;
	
	public Log4jServiceProviderImpl(Class<?> c) {
		this.setLogger(Logger.getLogger(c));
	}
	
	public Log4jServiceProviderImpl() {
		this(Log4jServiceProviderImpl.class);
	}

	public void debug(Object o) {
		logger.debug(o);
	}

	public void debug(Object o, Throwable t) {
		logger.debug(o, t);
	}

	public void error(Object o) {
		logger.error(o);
	}

	public void error(Object o, Throwable t) {
		logger.error(o, t);
	}

	public void fatal(Object o) {
		logger.fatal(o);
	}

	public void fatal(Object o, Throwable t) {
		logger.fatal(o, t);
	}

	public void info(Object o) {
		logger.info(o);
	}

	public void info(Object o, Throwable t) {
		logger.info(o, t);
	}

	public void warn(Object o) {
		logger.warn(o);
	}

	public void warn(Object o, Throwable t) {
		logger.warn(o, t);
	}

	public void config() throws ConfigurationException {
		
	}

	public Logger getLogger() {
		return logger;
	}

	public void setLogger(Logger logger) {
		this.logger = logger;
	}

	public boolean isTerminated() {
		return false;
	}
}